package fluxx.draft;

public class Has2Keepers extends Goal {
	
	// TODO maybe type Card?
	private final String keeper1, keeper2;

	public Has2Keepers(String name, String keeper1, String keeper2) {
		super(name, null);
		if (keeper1 == null || keeper2 == null)
			throw new IllegalArgumentException();

		this.keeper1 = keeper1;
		this.keeper2 = keeper2;
	}

	@Override
	public Player getWinner(GameState game) {
		for (Player player : game.players) {
			if (player.getKeepers().contains(keeper1) && player.getKeepers().contains(keeper2)) {
				return player;
			}
		}
		throw new RuntimeException("No winner");
	}
}
